

//Interface for a simple stopwatch. I made my own since
//std::clock() is screwy when multithreading on POSIX,
//so I have an std implementation using clock() ("stopwatch_std.cpp")
//and a linux implementation using gettimeofday() ("stopwatch_linux.cpp").
//I could have just used boost's solution, since boost::thread already
//uses it -- but that would have been smart.

class stopwatch
{
	public:
		void start();
		void stop();
		const bool running() const { return rng; }
		const unsigned long long int read();
		enum start_behavior { auto_start, manual_start };
		stopwatch(start_behavior sb = manual_start) : curr(0), data(0), rng(false)
		{
			initialize_data();
			if(sb == auto_start) start();
		}
		~stopwatch();
	private:
		void initialize_data();
		void calc_diff();
		unsigned long long int curr;
		void* data;
		bool rng;
};

